<?php 

include '../function.php';

try{
	$db = new PDO("mysql:host=127.0.0.1;dbname=school;charset=utf8","root","");


	// $sql = "select count(*) from stu";

	// $res = $db->query($sql);


	// var_dump($res->fetchAll(PDO::FETCH_ASSOC));
	// 
	
	$sql ="delete from stu where id >15";

	$sql = 'insert into stu (name,sex) values("小王王","人妖")';

	$res = $db->exec($sql);

	if(!$res){
		exit("错误代码：".$db->errorCode()."错误信息：".$db->errorInfo()[2]);
	}


	var_dump($res);





	
}catch(PDOException  $e ){
	echo "Error: ".$e;
}



include './Model.class.php';

$db = new Model();

$arr = array(
	'username'=>'小明',
	'passwrod'=>'sdfsdf',
	'email'=>'sdfsdf'
	);

$db->add($arr);

$db->delete('stu',8);

















 ?>